/*
 * ODO: Real-Time In-Memory ORM/DBMS Grid software
 * Copyright (c) 2008, Michael Oksenenko
 * All rights reserved.
 */
#ifndef OS_COMPONENT_FACTORY_HPP
#define OS_COMPONENT_FACTORY_HPP

#include "OsComponentFactoryIF.hpp"

#include "ConsoleIF.hpp"
#include "ErrorIF.hpp"
#include "ProcessIF.hpp"
#include "RegeditIF.hpp"
#include "SyslogIF.hpp"
#include "SyslogInstallerIF.hpp"

#include <memory>

namespace odo {

class OsComponentFactory {

private: // aux

	static void beforeComponentFactory();
	static void afterComponentFactory();
	
	template<class COMPONENT>
	static std::auto_ptr<COMPONENT>
	getComponent(OsComponentFactoryIF<COMPONENT>& aComponentFactory) {
		beforeComponentFactory();
		std::auto_ptr<COMPONENT> component = aComponentFactory.getComponent();
		afterComponentFactory();
		return component;
	}

public: // iface

	static std::auto_ptr<ConsoleIF>
		getConsole();

	static std::auto_ptr<ErrorIF>
		getError();

	static std::auto_ptr<ProcessIF>
		getProcess();

	static std::auto_ptr<RegeditIF>
		getRegedit();

	static std::auto_ptr<SyslogIF>
		getSyslog();

	static std::auto_ptr<SyslogInstallerIF>
		getSyslogInstaller();

public: // factory

	~OsComponentFactory();
	OsComponentFactory();

};

}

#endif /* OS_COMPONENT_FACTORY_HPP */
